package com.quanxiaoha.weblog.common.utils;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class PointsInterestCalculatorTest {

    public static void main(String[] args) {
        // 初始积分
        BigDecimal points = new BigDecimal("1000");
        // 开始时间
        LocalDateTime startTime = LocalDateTime.now();
        // 测试24小时
        int testHours = 24;
        
        System.out.println("初始积分：" + points);
        System.out.println("开始时间：" + startTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
        System.out.println("------------------------");
        
        // 计算并显示每个小时的本息
        for (int hour = 1; hour <= testHours; hour++) {
            LocalDateTime currentTime = startTime.plusHours(hour);
            BigDecimal result = PointsInterestCalculator.calculateInterest(points, startTime, currentTime);
            BigDecimal interest = result.subtract(points);
            
            System.out.println("第" + hour + "小时：");
            System.out.println("时间：" + currentTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
            System.out.println("本息合计：" + result);
            System.out.println("利息：" + interest);
            System.out.println("------------------------");
        }
    }
} 